@echo off
REM
REM This script only close current GUI-Window and GUI-Service 
REM That is to say kill all chrome.exe processes and current python.exe process
REM And Restart GUI-Service (python.exe process) and GUI-Window (chrome.exe process)
REM

echo Restart OFC GUI ...

set webview_path=%cd%
rem echo %webview_path%

cd ..

rem set root=%cd%
rem set python_path=%cd%\Python36\Python36

set PYPATH36=%cd%\Python36\Python36
set PYPATH38=%cd%\Python38\Python38
set PYPATH310=%cd%\Python310\Python310

if exist %PYPATH36% (
    echo use python36 env ...
    set python_path=%cd%\Python36\Python36
)

if exist %PYPATH38% (
    echo use python38 env ...
    set python_path=%cd%\Python38\Python38
) 

if exist %PYPATH310% (
    echo use python310 env ...
    set python_path=%cd%\Python310\Python310
) 

rem current disk
rem %~d0

rem cd %cd%\QSFP-DD-Beta1-004-Debug-GUI
cd %webview_path%

taskkill /F /FI "WINDOWTITLE eq OFC*"
@REM taskkill /IM "chrome.exe" /F
taskkill /IM "chrome.exe" /F

start "OFC GUI" "%python_path%\python.exe" -u "%webview_path%"\run.py

